PATHMac OS 8 Developer Documentation > Operating System Services > Multiprocessing Services >

Adding Multitasking Capability to Applications Using Multiprocessing Services

   

MPSetQueueReserve

Reserves space for messages on a specified message queue.

OSStatus MPSetQueueReserve (
                     MPQueueID queue,
                     ItemCount count);
queue
A value of type MPQueueID that specifies the ID of the queue whose messages you want to reserve.
count
A value of type ItemCount that specifies the number of messages to reserve.
function result
A result code. See Result Codes for a list of possible values.
DISCUSSION

MPNotifyQueue allocates spaces for messages dynamically; that is, memory to hold the message is allocated for the queue at the time of the call. In most cases this method is both speed and storage efficient. However, it is possible that, due to lack of memory resources, space for the message may not be available at the time of the call; in such cases, MPNotifyQueue will return kInsufficientResourcesErr .

If you must have guaranteed message delivery, or if you need to call MPNotifyQueue from an interrupt handler, you should reserve space on the specified queue by calling MPSetQueueReserve . Because such allocated space is reserved for duration of the queue's existence, you should avoid straining internal system resources by reserving messages only when absolutely necessary. Note that if you have reserved messages on a queue, additional space cannot be added dynamically if the number of messages exceeds the number reserved for that queue.

The number of reserved messages is set to count , lowering or increasing the current number of reserved messages as required. If count is set to zero, no messages are reserved for the queue, and space for messages is allocated dynamically.

VERSION NOTES

Introduced with Multiprocessing Services 2.0.


© 1999 Apple Computer, Inc. – (Last Updated 07 May 99)